
let xData = [];
let yData = [];
<!--let noise = getNoiseHelper();-->
<!--noise.seed(Math.random());-->
function generateData() {//theta, min, max
  let data = [];
  for (let i = 0; i <= 200; i++) {
    for (let j = 0; j <= 100; j++) {
      // let x = (max - min) * i / 200 + min;
      // let y = (max - min) * j / 100 + min;
      //data.push([i, j, noise.perlin2(i / 40, j / 20) + 0.5]);
      //data.push([i, j, noise.perlin2(i / 200, j / 125)*100 + 273.15]);
      // data.push([i, j, normalDist(theta, x) * normalDist(theta, y)]);
    }
    xData.push(i);
  }
  for (let j = 0; j < 100; j++) {
    yData.push(j);
  }
  for(let k=0;k<HeatMapData2D.length;k++)
  data.push(HeatMapData2D[k]);
  return data;
}

let data = generateData();//2, -5, 5

var dom = document.getElementById('heat-left1');
    var myChart = echarts.init(dom, null, {
      renderer: 'canvas',
      useDirtyRect: false
    });

var app = {};

var option = {
  tooltip : {
   trigger:"item", //item默认为图形触发 还有axis坐标轴触发
   //设置文字样式
    textStyle:{
        color:"black"
    },
   formatter: function (params) {
     // do some thing
     //console.log('params:');
     //console.log(params.data[1]);
     return  params.seriesName+'<br>•(x,y): ('+params.data[0]+','+params.data[1]+')<br>•温度(K): '+params.data[2].toFixed(2);;
  }
},

  grid:{
    //bottom:'0%'
  },
  title:{
    text:'隧道热源反演结果',
    left:'center',
    top:'1.5%'
  },
  xAxis: {
    name:'X/m',
    type: 'category',
    data: xData
  },
  yAxis: {
    name:'Y/m',
    type: 'category',
    data: yData
  },
  visualMap: {
    orient:'horizontal',
    min: 271.15,
    max: 313.15,
    calculable: true,
    realtime: false,//false
    inRange: {
      color: [
        '#313695',
        '#4575b4',
        '#74add1',
        '#abd9e9',
        '#e0f3f8',
        '#ffffbf',
        '#fee090',
        '#fdae61',
        '#f46d43',
        '#d73027',
        '#a50026'
      ]
    }
  },
  series: [
    {
      name: '热源点',
      type: 'heatmap',
      data: data,
      emphasis: {
        itemStyle: {
          borderColor: '#333',
          borderWidth: 1,
          //borderHeight: 2,
        }
      },
      //progressive: 1000,
      animation: false
    }
  ]
};

    if (option && typeof option === 'object') {
      myChart.setOption(option);
    }

    window.addEventListener('resize', myChart.resize);
